

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="${pageContext.request.contextPath }/common/plugin/zTree_v3-master/css/demo.css" type="text/css">
<link rel="stylesheet" href="${pageContext.request.contextPath }/common/plugin/zTree_v3-master/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="${pageContext.request.contextPath }/common/plugin/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/plugin/zTree_v3-master/js/jquery.ztree.core.js"></script>
  
  <script type="text/javascript">
  var setting = {
			
			data: {
				key: {
					title:"permission_url"
				},
				simpleData: {
					enable: true
				}
			},
			callback: {
				onClick: onClick
			}
		};
	
	function onClick(event, treeId, treeNode, clickFlag) {
		alert(treeNode.id);
	}
	
	function onClick(treeId, treeNode, clickFlag) {
		// 判断是否主菜单
		if (!treeNode.isParent) {
			var url = treeNode.rightUrl;
			var a = event.target.parentNode.parentNode;
			
			a.target = "mainFrame";  //这个是要跳转的框架的名字
			
			a.href='${pageContext.request.contextPath}/'+url;
		/* 	alert(a.href); */
		}
	}
	
	//初始化属性菜单
	$(document).ready(function() {
		$.get("${pageContext.request.contextPath}/PermissionServlet?flag=initPermission",function(data){
			//讲json转换成对象
			//alert(eval("("+data+")"));
	     //初始化树形菜单
		 $.fn.zTree.init($("#permissionTree"), setting, eval("("+data+")"));
		});
		
	
		
	});
  </script>

</head>
<body>
    <div class="leftContent">
	   <div class="permission">
		   <ul id="permissionTree" class="ztree"></ul>
	   </div>
	</div>
<%--<a href="${pageContext.request.contextPath }/PermissionServlet?flag=role" style="float: left">授权</a>
	<a href="${pageContext.request.contextPath }/PermissionServlet?flag=addPermission" style="float: left">权限新增</a><br>
	<a href="${pageContext.request.contextPath }/pages/addRole.jsp" style="float: left">角色新增</a>
	<a href="${pageContext.request.contextPath }/PermissionServlet?flag=preUpdate" style="float: left">角色维护</a>
	<a href="${pageContext.request.contextPath }/PermissionServlet?flag=classManager" style="float: left">班级管理</a> --%>
	
</body>
</html>